Completed
Push — master ( e65836...fa4d5c )
by Mathieu
12s queued 10s
created

Customer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 5

5 Functions

Rating   Name   Duplication   Size   Complexity  
A getAddress 0 3 1
A getId 0 3 1
A getCreatedAt 0 3 1
A getName 0 3 1
A updateName 0 3 1
1
import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm';
2
import {Address} from './Address.entity';
3
4
@Entity()
5
export class Customer {
6
  @PrimaryGeneratedColumn('uuid')
7
  private id: string;
8
9
  @Column({type: 'varchar', nullable: false})
10
  private name: string;
11
12
  @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
13
  private createdAt: Date;
14
15
  @ManyToOne(type => Address, {nullable: true, onDelete: 'SET NULL'})
16
  private address: Address;
17
18
  constructor(name: string, address: Address) {
19
    this.name = name;
20
    this.address = address;
21
  }
22
23
  public getId(): string {
24
    return this.id;
25
  }
26
27
  public getName(): string {
28
    return this.name;
29
  }
30
31
  public getCreatedAt(): Date {
32
    return this.createdAt;
33
  }
34
35
  public getAddress(): Address {
36
    return this.address;
37
  }
38
39
  public updateName(name: string): void {
40
    this.name = name;
41
  }
42
}
43